import request from '@/config/axios'

// facebook广告主 VO
export interface AdvertiserVO {
  id?: number | string | null
  advertiserId: number | null // 广告账号id
  advertiserName: string | null // 广告账户名称
  appId: number | null // 应用app_id
  status: 0 | 1 // 状态：0-正常；1-停用；
  updateStatus?: number // 更新状态：0-未完成；1-已完成；
  agent?: string // 代理商
  deptId: number | null // 部门id
  createName: string | null // 创建者名称
}

// facebook广告主 API
export const AdvertiserApi = {
  // 查询facebook广告主分页
  getAdvertiserPage: async (params: any) => {
    return await request.get({ url: `/facebook/advertiser/page`, params })
  },

  // 查询facebook广告主详情
  getAdvertiser: async (id: number) => {
    return await request.get({ url: `/facebook/advertiser/get?id=` + id })
  },

  // 新增facebook广告主
  createAdvertiser: async (data: AdvertiserVO) => {
    return await request.post({ url: `/facebook/advertiser/create`, data })
  },

  // 修改facebook广告主
  updateAdvertiser: async (data: AdvertiserVO) => {
    return await request.put({ url: `/facebook/advertiser/update`, data })
  },

  // 删除facebook广告主
  deleteAdvertiser: async (id: number) => {
    return await request.delete({ url: `/facebook/advertiser/delete?id=` + id })
  },

  // 导出facebook广告主 Excel
  exportAdvertiser: async (params) => {
    return await request.download({ url: `/facebook/advertiser/export-excel`, params })
  },
  // 更新广告主状态
  updateStatus: async (data: { id: number | string }) => {
    return await request.post({ url: `/facebook/advertiser/updateStatus`, data })
  },
  // 验证
  checkAdvertiser: async (ids: string) => {
    return await request.get({ url: `/facebook/advertiser/check?ids=` + ids })
  }
}
